<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>ask</title>
	<script src="public/js/jquery.min.js"></script>
	<link rel="stylesheet" href="public/css/common.css">
	<script src="public/index/js/login.js"></script>
</head>
<body>
	{{php}}
		if(isset($_SESSION['id']))
		{	
			echo "欢迎: ".Api('User/getUsername',[$_SESSION['id']]);
			echo " |  <a href='?m=Home&c=Login&a=quit'>退出</a>";
		}
		else
		{
			echo '<a href="javascript:;" onclick="showLoginModal();">登录</a>
			<a href="javascript:;" onclick="showRegModal();">注册</a>';
		}
	{{/php}}

	<a href="?m=Home&c=Ask&a=add">提问</a>
	
	<div class="modal login">
		<form onsubmit="return false;">
			<table border="1" width='100%'>
				<tr>
					<td>帐号</td>
					<td>
						<input type="text" name="username">
					</td>
				</tr>
				<tr>
					<td>密码</td>
					<td>
						<input type="text" name="password">
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<input type="submit" value='登录' onclick="login(this);">
					</td>
				</tr>
			</table>
		</form>
	</div>

	<div class="modal reg">
		<form onsubmit="return false" id="regFrom">
			<table border="1" width='100%'>
				<tr>
					<td>帐号</td>
					<td>
						<input type="text" name="username">
					</td>
				</tr>
				<tr>
					<td>密码</td>
					<td>
						<input type="text" name="password">
					</td>
				</tr>
				<tr>
					<td>确认密码</td>
					<td>
						<input type="text" name="password_c">
					</td>
				</tr>
				<tr>
					<td>验证码</td>
					<td>
						<input type="text" name="code">
						<img src="?m=Home&c=Login&a=code" alt="">
					</td>
				</tr>
				<tr>
					<td colspan="2"><input type="submit" value='登录' onclick="reg(this);"></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>